package com.haima.sage.bigdata.api.frame.interpreter.impl;

import java.util.List;
import java.util.Map;

import com.haima.sage.bigdata.api.frame.interpreter.ValueService;


/**
 * Created by taoistwar on 2017/7/22.
 */
public class MultiValueService implements ValueService {
    private List<ValueService> services;

    public MultiValueService(List<ValueService> services) {
        this.services = services;
    }

    @Override
    public String value(Map<?, ?> event) {
        StringBuilder sb = new StringBuilder();
        for (ValueService service : services) {
            String value = service.value(event);
            if (null != value && value.length() > 0) {
                sb.append(value);
            }
        }
        return sb.toString();
    }

}
